Leaflet 地图开发–Leaflet Map —Download Leaflet 下载leaflet

Leaflet 地图开发–Leaflet Map —Download Leaflet 下载leaflet

Version Description
Leaflet 1.9.3 Stable version, released on November 18, 2022.

稳定版,于2022年11月18日发布。

Leaflet 1.8.0 Previous stable version, released on April 18, 2022.

之前的稳定版本,于2022年4月18日发布。

Leaflet 2.0-dev In-progress version, developed on the main branch.

进行中版本,在主分支上开发。

View Changelog

Note that the main version can contain incompatible changes, so please read the changelog carefully when upgrading to it.

请注意,主版本可能包含不兼容的更改,因此升级到主版本时请仔细阅读更改日志。

Using a Hosted Version of Leaflet

使用托管版本的Leaflet

The latest stable Leaflet release is available on several CDN’s — to start using it straight away, place this in the head of your HTML code:

最新稳定的Leaflet版本可在多个CDN上获得-要立即开始使用,请将其放在HTML代码的开头:

unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>

Note that the integrity hashes are included for security when using Leaflet from CDN.

请注意,在使用CDN的传单时,为了安全起见,包含了完整性哈希。

Leaflet is available on the following free CDNs: unpkg, cdnjs, jsDelivr.

传单可在以下免费CDN上获得:unpkg、cdnjs、jsDelivr。

Disclaimer: these services are external to Leaflet; for questions or support, please contact them directly.

免责声明:这些服务与传单无关;如有疑问或支持,请直接与他们联系。

Using a Downloaded Version of Leaflet

使用下载版本的传单
Inside the archives downloaded from the above links, you will see four things:

在从以上链接下载的存档中,您将看到四件事:

leaflet.js – This is the minified Leaflet JavaScript code.

leaflet.js-这是缩小的leaflet JavaScript代码。
leaflet-src.js – This is the readable, unminified Leaflet JavaScript, which is sometimes helpful for debugging. (integrity=”sha256-V8Wsw6bWrfTsX9YUzIjKtnIoiUhBdulszoxf177/XjU=”)

leaflet-src.js-这是一种可读的、未经修饰的leaflet JavaScript,有时对调试很有帮助。(完整性=“sha256-V8Wsw6bWrfTsX9YUzIjKtnIoiUhBdulszoxf177/XjU=”)
leaflet.css – This is the stylesheet for Leaflet.

leaflet.css-这是leaflet的样式表。
images – This is a folder that contains images referenced by leaflet.css. It must be in the same directory as leaflet.css.
Unzip the downloaded archive to your website’s directory and add this to the head of your HTML code:

images-这是一个包含leaflet.css引用的图像的文件夹。它必须与leaflet.css位于同一目录中。将下载的存档解压缩到网站的目录中,并将其添加到HTML代码的开头:


Using a JavaScript package manager

使用JavaScript包管理器
If you use the npm package manager, you can fetch a local copy of Leaflet by running:

如果使用npm包管理器,可以通过运行以下命令获取传单的本地副本:

npm install leaflet

npm安装leaflet
You will find a copy of the Leaflet release files in node_modules/leaflet/dist.

您可以在node_modules/pleader/dist中找到leaflet发布文件的副本。

Leaflet Source Code

Leaflet 源代码
These download packages above only contain the library itself. If you want to download the full source code, including unit tests, files for debugging, build scripts, etc., you can download it from the GitHub repository.

以上这些下载包仅包含库本身。如果您想下载完整的源代码,包括单元测试、调试文件、构建脚本等,可以从GitHub存储库下载。

Building Leaflet from the Source

从源头构建Leaflet
Leaflet build system is powered by the Node.js platform, which installs easily and works well across all major platforms. Here are the steps to set it up:

Leaflet 构建系统由Node.js平台提供支持,该平台易于安装,并在所有主要平台上运行良好。以下是设置它的步骤:

Download and install Node

下载并安装节点
Run the following command in the command line:

在命令行中运行以下命令:
npm install
Now that you have everything installed, run npm run build inside the Leaflet directory. This will combine and compress the Leaflet source files, saving the build to the dist folder.

现在已经安装了所有内容,请在Leaflet目录中运行npm-run-build。这将合并并压缩传单源文件,将构建保存到dist文件夹。

5 1 投票
文章评分
订阅评论
提醒
0 评论
最旧
最新 最多投票
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x